
package creditcardapp.model;

import framework.model.Constant;
import framework.model.Customer;
import framework.model.Entry;

public class Gold extends CreditCardAccount {
    protected double INTEREST_RATE = 0.06;
    protected double MINIMUM_PAYMENT_RATE = 0.1;

    public Gold(Customer cust, String ccNumber, String expiredDate) {
        super(cust, ccNumber, expiredDate);
        interestRate = INTEREST_RATE;
        minPaymentRate = MINIMUM_PAYMENT_RATE;
    }

    @Override
    public String getType() {
        return Constant.CC_TYPE_GOLD;
    }
    
    @Override
    public double getNewMonthlyBalance() {
        double prevBalance = this.getLastMonthBalance();
        double totalCredits = this.getTotalMonthlyCredits();
        double totalCharges = this.getTotalMonthlyCharges();
        return prevBalance + totalCredits + totalCharges + (prevBalance)*interestRate;
    }

    @Override
    public double getNewMonthlyAmountDue() {
        return minPaymentRate * this.getNewMonthlyBalance();
    }   
    @Override
    public String createNotification(Entry e) {
        String msg = "Transaction is executed, amount: " + e.getAmount();;

        if (getCurrentBalance() < (-1) * Constant.CC_GOLD_LIMIT) {
            msg = "You have exceeded the GOLD credit limit";
        }
        return msg;
    }     
}
